package sedev.shopping.business;

import sedev.shopping.data.HinhThucDichVuDAO;
import sedev.shopping.entities.HinhThucDichVu;
import sedev.shopping.entities.ListHinhThucDichVu;
import sedev.shopping.util.Paging;
import sedev.shopping.util.SedevUtil;

public class HinhThucDichVuService {
	public static boolean addData(HinhThucDichVu data) {
		HinhThucDichVuDAO dao = new HinhThucDichVuDAO();
		return dao.addData(data);
	}

	public static boolean updateData(HinhThucDichVu data) {
		HinhThucDichVuDAO dao = new HinhThucDichVuDAO();
		return dao.updateData(data);
	}

	public static boolean removeData(int id) {
		HinhThucDichVuDAO dao = new HinhThucDichVuDAO();
		return dao.removeData(id);
	}

	public static HinhThucDichVu getData(int id) {
		HinhThucDichVuDAO dao = new HinhThucDichVuDAO();
		return dao.getData(id);
	}

	public static ListHinhThucDichVu getListDataByAll(SedevUtil.Order orderType ) {
		StringBuilder field = new StringBuilder();
		field.append(HinhThucDichVu.Properties.id.name());
		field.append(",").append(HinhThucDichVu.Properties.ten.name());

		StringBuilder condition = new StringBuilder();
		condition.append("1 AND 1");

		StringBuilder order = new StringBuilder();
		order.append(HinhThucDichVu.Properties.id.name()).append(" ").append(
				orderType.name());
		Paging paging = new Paging();
		
		HinhThucDichVuDAO dao = new HinhThucDichVuDAO();
		return dao.getListData(field.toString(), condition.toString(), order.toString(), paging);
	}
}
